package cn.iocoder.yudao.module.paymember.controller.app.copying;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
import cn.iocoder.yudao.module.paymember.controller.app.copying.vo.KefuQrCodeRespVO;
import cn.iocoder.yudao.module.paymember.controller.app.copying.vo.XhsCopyingRespVO;
import cn.iocoder.yudao.module.paymember.controller.app.copying.vo.ZhuliQrCodeRespVO;
import cn.iocoder.yudao.module.paymember.service.copying.PaymemberCopyingService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "用户（有关笔试） - 服务")
@RestController
@RequestMapping("/system/service")
@Validated
public class AppServiceController {

    @Value("${yudao.service.kefu}")
    private String kefuQrCode;
    @Value("${yudao.service.zhuli}")
    private String zhuliQrCode;

    @Resource
    private PaymemberCopyingService paymemberCopyingService;

    @GetMapping("/kefu-qrcode")
    @Operation(summary = "客服二维码")
    public CommonResult<KefuQrCodeRespVO> getKefuQrCode() {
        KefuQrCodeRespVO kefuQrCodeRespVO = new KefuQrCodeRespVO();
        kefuQrCodeRespVO.setImgUrl(kefuQrCode);
        return success(kefuQrCodeRespVO);
    }

    @GetMapping("/zhuli-qrcode")
    @Operation(summary = "助力二维码")
    public CommonResult<ZhuliQrCodeRespVO> getZhuliQrCode() {
        ZhuliQrCodeRespVO zhuliQrCodeRespVO = new ZhuliQrCodeRespVO();
        zhuliQrCodeRespVO.setImgUrl(zhuliQrCode);
        return success(zhuliQrCodeRespVO);
    }

    @GetMapping("/xhs-copying")
    @Operation(summary = "小红书文案")
    public CommonResult<XhsCopyingRespVO> getXhsCopying() {
        return success(paymemberCopyingService.getXhsCopyingInfo(WebFrameworkUtils.getLoginUserId()));
    }

}